<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
package <xsl:value-of select="Schema/@NameSpace" />;

import System.*;
import System.Data.*;
import System.Data.SqlClient.*;
import System.Data.SqlTypes.*;
import System.Xml.*;
import System.Reflection.*;
import System.Configuration.*;
import ESpace.DALibrary.*;

public class <xsl:value-of select="Schema/@StoreProcedureName" /> extends DataAccessBase
{
	public <xsl:value-of select="Schema/@StoreProcedureName" />()
	{
		ConnectionString = ConfigurationSettings.AppSettings["<xsl:value-of select="Schema/@DBName" />"];
		base.InitCommand("<xsl:value-of select="concat('[',Schema/@Owner,'].[',Schema/@StoreProcedureName,']')" />");
		ConfigParameter();
	}
<xsl:for-each select="Schema/Columns">
	private SqlParameter param<xsl:value-of select="COLUMN_NAME" />;
	public <xsl:value-of select="concat(LANGUAGE_TYPE,' ',COLUMN_NAME)" />
	{
		get
		{
			return (<xsl:value-of select="LANGUAGE_TYPE" />)param<xsl:value-of select="COLUMN_NAME" />.Value;
		}
		set
		{
			param<xsl:value-of select="COLUMN_NAME" />.Value = value;
		}
	}
</xsl:for-each>
	public void ConfigParameter()
	{<xsl:for-each select="Schema/Columns">
		//--------------------------------------------------------
		param<xsl:value-of select="COLUMN_NAME" /> = new SqlParameter();
		param<xsl:value-of select="COLUMN_NAME" />.ParameterName = "@<xsl:value-of select="COLUMN_NAME" />";
		param<xsl:value-of select="COLUMN_NAME" />.SqlDbType = <xsl:value-of select="DB_TYPE" />;
		param<xsl:value-of select="COLUMN_NAME" />.Size = <xsl:value-of select="LENGTH" />;
		param<xsl:value-of select="COLUMN_NAME" />.Direction = ParameterDirection.<xsl:choose>
			<xsl:when test="COLUMN_TYPE='1'">Input</xsl:when>
			<xsl:when test="COLUMN_TYPE='2'">Output</xsl:when>
			<xsl:when test="COLUMN_TYPE='5'">ReturnValue</xsl:when>
		</xsl:choose>;
		param<xsl:value-of select="COLUMN_NAME" />.Value = DBNull.Value;
		base.sqlComm.Parameters.Add(this.param<xsl:value-of select="COLUMN_NAME" />);</xsl:for-each>
	}
}</xsl:template>
</xsl:stylesheet>